package com.youlu.campus.activity.service.impl;

import com.youlu.campus.activity.repositories.ActivityInfoRepository;
import com.youlu.campus.activity.service.ActivityInfoService;
import com.youlu.campus.entity.ActivityInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 活动实体类
 *
 * @Description: ActivityInfoServiceImpl
 * @Date 2025/7/28
 * @module ActivityInfoServiceImpl
 * @author: su
 */
@Slf4j
@Service
public class ActivityInfoServiceImpl implements ActivityInfoService {


    @Autowired
    private ActivityInfoRepository activityInfoRepository;

    @Override
    public ActivityInfo findById(String activityId) {
        Optional<ActivityInfo> optional = activityInfoRepository.findById(activityId);
        if (optional.isPresent()) {
            return optional.get();
        }
        return null;
    }

    @Override
    public ActivityInfo save(ActivityInfo activityInfo) {
        return activityInfoRepository.save(activityInfo);
    }
}
